#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

"""
@author: JoeyZhou
@Tool: PyCharm
@Date: 2020/2/13 9:01 PM
"""

# 这不是login接口！！！！！！！！！！！

import requests
import json


class RunMain:
    headers = {
        'Accept': 'application/json',
        'Connection': 'keep-alive',
        'Version': '1.50.0',
        'User-Agent': 'OPTapp/1.30.0 (com.aihuishou.OPTapp.E; build:912; iOS 12.4.0) Alamofire/4.9.0',
        'Platform': 'ios', 'Device-ID': 'EF047AF2-DACA-4BB4-95B3-DD585429C3D5',
        'App-ID': 'pjt042401'
    }

    # def send_post(self, url, data=None):
    #     res = requests.post(url=url, json=data, headers=self.headers).json()
    #     return json.dumps(res, indent=4)
    #
    #
    # def send_get(self, url):
    #     res = requests.get(url=url, json=data, headers=self.headers).json()
    #     return json.dumps(res, indent=4)
    #
    #
    # def run_main(self, url, data, method):
    #     res = None
    #     if method == 'GET':
    #         res = self.send_get(url)
    #     else:
    #         res = self.send_post(url, data)
    #     return res

    def login(self, url, data):
        res = requests.post(url=url, json=data, headers=self.headers).json()
        return json.dumps(res, indent=4)


if __name__ == '__main__':
    url = "http://uat-sj-gateway.aihuishou.com/sj-api/auth/login"
    data = {
        "userName": "13969696969",
        "passWord": "qwer1234"
    }

    rm = RunMain()
    print(rm.login(url, data))
    # print(rm.run_main(url, data, 'POST'))
